<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>需方业主</title>
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--公用样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/comment.css">
    <!--页面样式-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/style.css">
    <link rel="stylesheet" href="${re.contextPath}/plugin/common/css/extended.css">
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
</head>

<style type="text/css">

    .Right {
        width: 100%;
        overflow-y: scroll;
    }

    .layui-col-md3 {
        width: 25%;
    }

    .layui-tab {
        margin: 50px 0;
        text-align: left !important;
        border-radius: 10px;
        margin-left: 30px;
        width: 93%;
        padding: 1% 2%;
        margin: 30px auto;
        border-radius: 10px 10px 0px 0px;
        margin: 20px 1px;
    }

    .layui-tab-content {
        padding: 0px;
    }

    .layui-tab-title {
        position: relative;
        left: 0;
        height: 40px;
        white-space: nowrap;
        font-size: 0;
        border-bottom-width: 1px;
        border-bottom-style: solid;
        transition: all .2s;
        -webkit-transition: all .2s;
        background-color: white;
        border-radius: 10px 10px 0px 0px;
    }

    .layui-laypage-limits {
        width: 120px;
    }

    img[src=""], img:not([src]) {
        opacity: 0;
    }
</style>

<body>
<!--容器-->
<div class="container index clearfix">
    <!--右侧内容-->
    <div class="Right fr" style="overflow-y: hidden;">

        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="margin-top: 12px;">
            <ul class="layui-tab-title bold " style="padding-top: 20px;padding-left: 20px;">
                <li class="layui-this">个人信息</li>
                <li <#if (shenhe == '1')>style="display: none"</#if>>个人设置</li>
                <li <#if (shenhe == '1')>style="display: none"</#if>>修改密码</li>
                <li <#if (shenhe == '1')>style="display: none"</#if>>项目评分</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form action="" class="layui-form" enctype="multipart/form-data">
                        <!--个人信息-->
                        <div class="myDatatTop whitebg">
                            <div class="myDataCentere"
                                 style="margin-top: 0px;margin-left: 0px;  margin-bottom: 20px; width: 96%;">
                                <ul class="clearfix" style="width: 85%;padding-bottom: 20px;">
                                    <li class="clearfix">
                                        <label class="fl">角色</label>
                                        <input type="text" class="fl" value="${user.gxname}" disabled>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">业务类型</label>
                                        <input type="text" class="fl" value="${user.ywname}" disabled>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">身份</label>
                                        <input type="text" class="fl" value="${user.ptname}" disabled>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">用户名</label>
                                        <input type="text" class="fl" value="${user.username}" disabled>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">单位名称</label>
                                        <input type="text" class="fl" value="${user.companyName}" disabled>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl">组织机构代码</label>
                                        <input type="text" id="jgcode" class="fl" value="${user.jgcode}" disabled>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div class="myData whitebg" style="margin-left: 0px;width: 96%;">
                            <span class="audit-status audit-status1" style="color: green" <#if (user.auditStatus != '1')>hidden</#if>>审核通过</span>
                            <span class="audit-status audit-status3" style="color: darkorange" <#if (user.auditStatus != '3')>hidden</#if>>审核中</span>
                            <span class="audit-status audit-status2 red" <#if (user.auditStatus != '2')>hidden</#if>>信息审核未通过，驳回原因：${user.auditFailReason}</span>
                            <div class="myDataCentere myDataCentereTwo mt30">
                                <ul class="clearfix" style="width: 90%;">
                                    <li class="clearfix">
                                        <label class="fl w9p">LOGO</label>
                                        <label>
                                            <div class="fl">
                                                <#if "${file}" !="${null}" && (file.xgtx) != "${null}">
                                                    <img src="${file.xgtx}" alt="" id="img4" class="ml20">
                                                <#else>
                                                    <img class="layui-upload-img ml20" id="img4"
                                                         src="${re.contextPath}/plugin/common/images/zzlogo.jpg">
                                                </#if>
                                                <button type="button" lay-data="{type: '208',imgid:'img4'}"
                                                        class="gr_upload whitebutton ft12 blue ml20">修改LOGO
                                                </button>
                                            </div>
                                        </label>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>单位性质</label>
                                        <div>
                                            <select id=companyType" lay-verify="companyType"
                                                    name="companyType" lay-verify="companyType" lay-ignore>
                                                <#list dwlist as vo>
                                                    <#if "${user.companyType}" =="${vo.badtCode}">
                                                        <option value="${vo.badtCode}"
                                                                selected="true">${vo.badtName}</option>
                                                    <#else>
                                                        <option value="${vo.badtCode}">${vo.badtName}</option>
                                                    </#if>
                                                </#list>
                                            </select>
                                        </div>
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>联系人</label>
                                        <input type="text" name="linkPerson" id="linkPerson" lay-maxlength="40" lay-verify="required|maxlength"
                                               class="fl" value="${user.linkPerson}">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span>联系方式</label>
                                        <input type="text" name="phoneNumber" lay-verify="phoneNumber" id="phoneNumber"
                                               class="fl" value="${user.phoneNumber}">
                                    </li>
                                    <li class="clearfix">
                                        <label class="fl"><span class="red">*</span> 注册地址</label>
                                        <div class="layui-col-md3" style="display: inline;">
                                            <select name="province" id="province" lay-verify="province"
                                                    style="width: 25% !important;" lay-filter="province">
                                                <#--   <option value="">请选择</option>-->
                                                <#list provincelist as vo>
                                                    <#if "${user.province}" =="${vo.code}">
                                                        <option value="${vo.code}" selected="true">${vo.name}</option>
                                                    <#else>
                                                        <option value="${vo.code}">${vo.name}</option>
                                                    </#if>
                                                </#list>
                                            </select>
                                        </div>
                                        <div class="layui-col-md3 ml10" style="display: inline;">
                                            <select name="city" id="city" class="ml10" lay-verify="city"
                                                    style="width:25% !important;" lay-filter="city">
                                                <#list citylist as vo>
                                                    <option value="${vo.code}">${vo.name}</option>
                                                    <#if "${user.city}" =="${vo.code}">
                                                        <option value="${vo.code}" selected="true">${vo.name}</option>
                                                    </#if>
                                                </#list>
                                            </select>
                                        </div>
                                    </li>
                                    <li class="clearfix" style="float:right">
                                        <label class="fl">详细地址</label>
                                        <input type="text" name="address" lay-maxlength="40" lay-verify="maxlength" id="address" class="fl"
                                               value="${user.address}">
                                    </li>
                                    <li class="clearfix" style="margin-top:10px">
                                        <label class="fl"><span class="red">*</span> 邮箱</label>
                                        <input type="text" name="email" lay-verify="email|required" id="email" class="fl"
                                               value="${user.email}">
                                        <input type="hidden" name="id" id="id" value="${user.id}">
                                    </li>


                                </ul>
                            </div>
                        </div>
                        <div class="myData whitebg" style="margin-left: 0px;width: 96%;">
                            <div class="myDataCentere myDataCentereThree mt30">
                                <ul class="clearfix" style="width: 90%;">
                                    <li class="clearfix">
                                        <label class="fl w8p"><span class="red">*</span>营业执照</label>
                                        <label>
                                            <div class="fl clearfix" style="margin-right: 20px;">
                                                <div id="bus_div" class="upCard fl ml20 mt10">
                                                    <img src="${re.contextPath}/plugin/common/images/57@2x.png" alt="">
                                                    <button type="button" lay-data="{type: '201',imgid:'img'}"
                                                            class="gr_upload whitebutton">上传营业执照
                                                    </button>
                                                </div>
                                            </div>
                                        </label>
                                        <div class="layui-upload-list" style="position: relative;float: left;">
                                            <#if "${file}" !="${null}" && (file.yyzz) != "${null}">
                                                <img src="${re.contextPath}/plugin/common/images/close.png"
                                                     style="width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor: pointer;"
                                                     data-type="201" data-id="img"
                                                     id="delimg"
                                                     onclick="deleteImg('${file.yyzz}', 1, this)"/>
                                                <img class="layui-upload-img bus_img cursor" id="img" height="100"
                                                     width="150"
                                                     src="${file.yyzz}" onclick="showImg(this)">
                                            <#else>
                                                <img src="${re.contextPath}/plugin/common/images/close.png"
                                                     style="width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor: pointer;display: none;"
                                                     id="delimg"
                                                     data-type="201" data-id="img"
                                                     onclick="deleteImg('', 2, this)"/>
                                                <img class="layui-upload-img bus_img cursor" id="img" height="100"
                                                     width="150"
                                                     style="display:none" onclick="showImg(this)">
                                            </#if>
                                            <p id="demoText"></p>
                                        </div>

                                    </li>
                                </ul>
                            </div>

<#--                            <div style="width: 90%;margin: auto;">-->
<#--                                <input id="agree_checkbok" type="checkbox" class="ml10" lay-ignore="true"-->
<#--                                       style="width:16px;height:16px;margin-top:2px">-->
<#--                                <span>同意</span>-->
<#--                                <a href=""><span class="blue">《供需对接服务信息发布规则》</span></a>-->
<#--                            </div>-->

                        </div>


                        <div class="myDataBtn center">
                            <button class="bluebg white bor0" lay-filter="submitUser" lay-submit type="button">保存
                            </button>
                        </div>
                    </form>
                    <#if (shenhe == '1')>
                        <div class="layui-row">
                            <div class="layui-col-md1 layui-col-md-offset5">
                                <input class="layui-btn layui-btn-normal ashow" type="button" value="审核通过" onclick="pass()">
                            </div>
                            <div class="layui-col-md1">
                                <input class="layui-btn layui-btn-danger ashow" type="button" value="审核拒绝" onclick="noPass()">
                            </div>
                        </div>
                    </#if>
                </div>
                <div class="layui-tab-item">
                    <div class="myDatatTop whitebg" style="padding: 20px 5%;">
                        <form action="" class="layui-form" enctype="multipart/form-data">
                            <div class="myDataCentere"
                                 style="margin-top: 0px;margin-left: 0px;  margin-bottom: 20px; width: 100%;">
                                <div class="set mt50">
                                    <div class="clearfix">
                                        <label class="fl mt10">项目显示标签个数</label>
                                        <input type="text" name="numTag" id="numTag" lay-verify="numTag" type="password"
                                               value="${user.numTag}" class="fl ml10"
                                               onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                                               onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}">
                                        <input type="hidden" name="id" id="id" value="${user.id}">
                                        <input type="hidden" name="username" id="username" value="${user.username}">
                                        <span class="fl mt10 ml10">个</span>
                                    </div>
                                    <ul class="clearfix">
                                        <li class="clearfix">
                                            <div class="fl">
                                                <div>电子签章</div>
                                                <div class="dzbor" style="position: relative;float: left;">
                                                    <#if "${file}" !="${null}" && (file.dzqz) != "${null}">
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg1"
                                                             data-type="202" data-id="img1"
                                                             onclick="deleteImg('${file.dzqz}', 1, this)"/>
                                                        <img class="layui-upload-img" id="img1"
                                                             src="${file.dzqz}">
                                                    <#else>
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="display: none;width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg1"
                                                             data-type="202" data-id="img1"
                                                             onclick="deleteImg('', 2, this)"/>
                                                        <img class="layui-upload-img" id="img1"
                                                             src="" style="display: none">
                                                    </#if>
                                                </div>
                                            </div>
                                            <div class="fr mt50">
                                                <div class="pink">建议：100KB</div>
                                                <div class="pink">要求：白背景</div>
                                                <button type="button" lay-data="{type: '202',imgid:'img1'}"
                                                        class="blue mt50 gr_upload">点击上传
                                                </button>
                                            </div>
                                        </li>
                                        <li class="clearfix">
                                            <div class="fl">
                                                <div>电子签名</div>
                                                <div class="dzbor" style="position: relative;float: left;">
                                                    <#if "${file}" !="${null}" && (file.dzqm) != "${null}">
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg2"
                                                             data-type="203" data-id="img2"
                                                             onclick="deleteImg('${file.dzqm}', 1, this)"/>
                                                        <img class="layui-upload-img" id="img2"
                                                             src="${file.dzqm}"
                                                             style="height: 150px">
                                                    <#else>
                                                        <img src="${re.contextPath}/plugin/common/images/close.png"
                                                             style="display: none;width: 30px;height: 30px;position: absolute;right: 0;top: 0;cursor:pointer;"
                                                             id="delimg2"
                                                             data-type="203" data-id="img2"
                                                             onclick="deleteImg('', 2, this)"/>
                                                        <img class="layui-upload-img" id="img2"
                                                             src=""
                                                             style="height: 150px;display: none">
                                                    </#if>
                                                </div>
                                            </div>
                                            <div class="fr mt50">
                                                <div class="pink">建议：100KB   </div>
                                                <div class="pink">要求：白背景</div>
                                                <div class="pink">长宽比例：3:2</div>
                                                <button type="button" lay-data="{type: '203',imgid:'img2'}"
                                                        class="blue mt80 gr_upload">点击上传
                                                </button>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                                <div class="myDataBtn center">
                                    <button class="bluebg white bor0" lay-filter="submitNum" lay-submit type="button">
                                        保存
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="myDatatTop whitebg">
                        <form class="layui-form" method="post">
                            <div class="modify pt50 pl30">
                                <ul>
                                    <li class="clearfix">
                                        <label class="fl ta_right">用户名</label>
                                        <span class="ml20">${user.username}</span>
<#--                                        <input type="text" class="fl" value="${user.username}" disabled>-->
                                        <input type="hidden" name="id" id="id" value="${user.id}">
                                    </li>
                                    <li class="clearfix" style="margin-top:30px">
                                        <label class="fl ta_right">原始密码</label>
                                        <input name="pass" id="pass" type="password" class="fl ml20 w30p" lay-verify="pass"
                                               placeholder="请输入原始密码">
                                    </li>
                                    <li class="clearfix" style="margin-top:30px">
                                        <label class="fl ta_right">新密码</label>
                                        <input name="newPwd1" id="newPwd1" type="password" lay-verify="newPwd1"
                                               class="fl ml20 w30p" placeholder="请输入新密码">
                                        <span class="fl w40p ml10 password_explain">密码最少为8位,且至少包含大写字母、小写字母、数字、特殊字符(~!@#$%^&*)中的三种</span>
                                    </li>
                                    <li class="clearfix" style="margin-top:30px">
                                        <label class="fl ta_right">确认密码</label>
                                        <input name="newPwd" id="newPwd" type="password" class="fl ml20 w30p" lay-verify="newPwd"
                                               placeholder="请再次输入新密码">
                                    </li>
                                </ul>
                                <div class="myDataBtn center">
                                    <button class="bluebg white bor0" lay-filter="submitPwd" lay-submit type="button">
                                        保存
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="myDatatTop whitebg" style="padding:50px;" >
                        <table id="envtable" lay-filter="envtable"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--公用样式JS-->
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<script type="text/javascript" src="${re.contextPath}/plugin/tools/cardUtils.js"></script>
<script type="text/html" id="envdetail">
<span class="dodgerblue cursor" spid="{{d.spId}}" onclick="seeEnvDetail(this)">查看详情</span>
</script>
<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function () {
        var element = layui.element;
        //…
    })
    var layer;
    var form = layui.form,table;
    $(function () {
        var shenhe = '${shenhe}';
        if(shenhe){
            $('input:not(.gr_upload):not(.ashow)[type="button"]').hide();
            $('button:not(.gr_upload)').hide();
            $('input:not(.ashow)').attr('disabled','disabled');
            $('select').attr('disabled','disabled');
            $('textarea').attr('disabled','disabled');
            setTimeout(function(){
                $('input:not(.gr_upload):not(.ashow)[type="button"]').hide();
                $('button:not(.gr_upload)').hide();
                $('input:not(.ashow)').attr('disabled','disabled');
                $('select').attr('disabled','disabled');
                $('.upCard').css('cursor','default');
                $('button').css('cursor','default');
                $('a').css('cursor','default');
            },2000);
        }
        layui.use(['form', 'layer','table'], function () {
            table = layui.table;
            form.verify({
                maxlength: function (v,item) {
                    var maxlength = item.getAttribute('lay-maxlength');
                    if(v.trim()!=''){
                        if(v.trim().length>maxlength){
                            return "输入长度不能大于"+maxlength+"个字符！";
                        }
                    }
                },
                companyName: function (v) {
                    if (v.trim() == '') {
                        return "公司名称不能为空";
                    }
                }, linkPerson: function (v) {
                    if (v.trim() == '') {
                        return '联系人不能为空';
                    }
                }, companyType: function (v) {
                    if (v.trim() == '') {
                        return '单位性质不能为空';
                    }
                }, email: function (v) {
                    if (v.trim() != '') {
                        var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
                        var flag = reg.test(v.trim());
                        if (!flag) {
                            return '邮箱格式输入有误';
                        }
                    }
                }
                , province: function (v) {
                    if (v.trim() == '') {
                        return '省不能为空';
                    }
                }, city: function (v) {
                    if (v.trim() == '') {
                        return '市不能为空';
                    }
                },
                phoneNumber: function (v) {
                    if (v.trim() == '') {
                        return '联系方式不能为空';
                    } else {
                        if (!v.trim().isMobile() && !v.trim().isTel()) {
                            return '请输入正确的手机号码或电话号码\n\n例如:13916752109或0531-3614072';
                        }
                    }
                }, pass: function (v) {
                    if (v.trim() == '') {
                        return '原密码不能为空';

                    }
                },
                jgcode: function (v) {
                    if (v.trim() == '') {
                        return '组织机构代码不能为空';
                    }
                },
                newPwd1: function (v) {
                    if (v.trim() == '') {
                        return '新密码不能为空';
                    }
                    var result = '';
                    $.ajax({
                        url: '/sys/register/checkpwd',
                        data: {pwd: v.trim()},
                        type: 'GET',
                        cache: false,
                        async: false,
                        success: function (res) {
                            if (!res.flag) {
                                result = '密码格式输入有误';
                            }
                        }
                    })
                    return result;
                }, newPwd: function (v) {
                    if (v.trim() == '') {
                        return '确认密码不能为空';
                    }
                    var newPwd1 = $("#newPwd1").val().trim();
                    if (v.trim() != newPwd1) {
                        return '两次密码不一致';
                    }
                }, numTag: function (v) {
                    if (v.trim() == '') {
                        return "标签个数不能为空";
                    }
                }

            });

            //监听提交
            form.on('submit(submitUser)', function (data) {
                if (!checkPhoto('bus', '营业执照')) {
                    return;
                }
                ;
                // if (!($("#agree_checkbok")[0].checked)) {
                //     layer.msg("需要同意《供需对接服务信息发布规则》", {icon: 2});
                //     return;
                // }
                layerAjax('/sys/personCenter/updateUsers', data.field, '', function (d) {
                    if (d.flag == true) {
                        layer.msg("已提交，请耐心等待管理员审核", {icon: 1});
                        flushAuditStatus();
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                });
                return false;
            });
            //修改标签个数
            form.on('submit(submitNum)', function (data) {
                layerAjax('/sys/personCenter/updateNum', data.field, '', function (d) {
                    if (d.flag == true) {
                        layer.msg(d.msg, {icon: 1});
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                });
                return false;
            });
            //修改密码
            form.on('submit(submitPwd)', function (data) {
                layerAjax('/sys/personCenter/rePass', data.field, '', function (d) {
                    if (d.flag == true) {
                        layer.msg(d.msg, {icon: 1});
                        $("#pass").val('');
                        $("#newPwd1").val('');
                        $("#newPwd").val('');
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                    console.log(d);
                });
                return false;
            });
            form.render();

            //评分表格：
            table.render({
                elem: '#envtable'
                // ,height: 'full-200'
                ,url: '/supervisor/projectManager/tagList' //数据接口
                ,page: true //开启分页
                ,height: 'full-200'
                ,cols: [[ //表头
                    {field: 'spId', hide: true}
                    ,{field: 'speTarget', hide: true}
                    ,{field: '', title: '序号',align: 'center',width: '11%', templet: function (res) {
                            return res.LAY_INDEX;
                        }}
                    ,{field: 'spName',align: 'center',width: '30%', title: '项目名称'}
                    ,{field: 'score',align: 'center',width: '30%', title: '项目总平均分'}
                    ,{field: 'action',align: 'center',width: '20%', title: '操作',templet: '#envdetail' }
                ]],
                parseData: function(res){
                    return {
                        "code" : res.code,
                        "msg": res.msg,
                        "count": res.count,
                        "data": res.data
                    }
                }
            });


        });
    });

    var jsondata = {
        type: '101'
    }
    var _imgid = 'img';
    layui.use('upload', function () {
        var upload = layui.upload;
        //执行实例
        upload.render({
            elem: '.gr_upload',//绑定元素
            url: '/sys/personCenter/uploadFile',//上传接口
            data: jsondata,
            acceptMime: 'image/*',
            before: function (obj) {
                var files = this.files = obj.pushFile();
                jsondata.type = this.type;
                _imgid = this.imgid;
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#' + _imgid).attr('src', '');
                    $('#' + _imgid).show();
                    $('#del' + _imgid).show();
                    $('#' + _imgid).attr('src', result); //图片链接（base64）
                    if ('208' == jsondata.type) {
                        parent.changeLogo(result);
                    }
                });
            },
            done: function (res, index) {
                if (res.flag == true) {
                    // $('#' + _imgid).show().attr('src', '');
                    // $('#' + _imgid).show().attr('src', res.data);
                    if (res.josnObj) {
                        var json = res.josnObj.words_result;
                        if(json){
                            var ToStr = JSON.stringify(json);
                            if ($('#jgcode').val() != JSON.stringify(ToStr).substr(26, 18)) {
                                //提示营业执照不匹配,请重新上传
                                layer.msg("营业执照不匹配,请重新上传!", {icon: 2});
                                delete this.files[index];
                                return;
                            }
                        }
                        // $('#jgcode').val(JSON.stringify(ToStr).substr(26,18));
                    }
                    layer.msg("上传成功",{icon:1});
                } else {
                    layer.msg('上传失败' + res.msg);
                }
                delete this.files[index];
            },
            error: function () {
                //请求异常回调
                var demoText = $('#demoText');
                layer.msg('上传失败');
            }
        });
    })

    // 电话校验
    String.prototype.Trim = function () {
        var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);
        return (m == null) ? "" : m[1];
    };
    String.prototype.isMobile = function () {
        return (/^1[3|4|5|7|8|9][0-9]\d{4,8}$/.test(this.Trim()));
    };
    String.prototype.isTel = function () {
        //"兼容格式: 国家代码(2到3位)-区号(2到3位)-电话号码(7到8位)-分机号(3位)"
        //return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
        return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(this.Trim()));
    };
    /*--------------------选择省获取市-----------------------------------------*/
    form.on('select(province)', function (data) {
        var code = data.value;
        if (code == "") {
            return;
        }
        $.ajax({
            cache: true,
            type: "get",
            url: "getCity",
            data: {"code": code},
            success: function (data) {
                $("#city").empty();
                /*    $("#city").append("<option value=''>选择市</option>");*/
                for (var i = 0; i < data.length; i++) {
                    $("#city").append("<option value='" + data[i].code + "'>" + data[i].name + "</option>");
                }
                layui.form.render("select")
            }, error: function (error) {
                return;
            }
        })
    });

    function getId(){
        return Date.now()+(Math.random()*1000000).toString().substr(0,3);
    }

    function pass(){
        var auditStatus = '1';
        var sendData = {
            id: $("#id").val(),
            auditStatus: '1'
        }
        audit(sendData);
    }

    function noPass(){
        layer.prompt({title: '拒绝原因', formType: 2}, function(text, index){
            if(text.length > 60){
                layer.msg("超出限制60字",{icon:2});
                return ;
            }
            layer.close(index);
            var sendData = {
                id: $("#id").val(),
                auditStatus: '2',
                auditFailReason: text
            }
            audit(sendData);
        });

    }

    function audit(data){
        $.ajax({
            url: '/sys/personCenter/audit',
            data: data,
            type: 'post',
            dataType: 'json',
            success: function(res){
                if(res.flag){
                    layer.msg('操作成功',{icon:1});
                    closeThisPage();
                }else{
                    layer.msg(res.msg,{icon:2})
                }
            }
        });
    }

    function closeThisPage(){
        //关闭当前页面
        setTimeout(function(){
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        },1000);
    }

    function checkPhoto(mark, name) {
        if (!($("." + mark + "_img").attr("src"))) {
            $("html, body").animate({scrollTop: $("#" + mark + "_div").offset().top - 100}, 500)
            $("#" + mark + "_div").css('border', '1px dashed red');
            setTimeout(function () {
                $("#" + mark + "_div").css('border', '1px dashed #3D6AFF');
            }, 1500);
            layer.msg("请上传" + name + "照片", {icon: 2});
            return false;
        }
        ;
        return true;
    }

    function flushAuditStatus(){
        $.ajax({
            url: '/sys/personCenter/getAuditStatus',
            data: {id: $("#id").val()},
            type: 'get',
            cache: false,
            dataType: 'json',
            success: function(res){
                if(res && res.flag){
                    var newAuditStatus = res.data;
                    if(newAuditStatus){
                        $(".audit-status:not(.audit-status"+newAuditStatus+")").attr('hidden','true');
                        $(".audit-status"+newAuditStatus).show();
                        if(newAuditStatus == '2'){
                            $(".audit-status"+newAuditStatus).html('信息审核未通过，驳回原因：'+res.msg);
                        }
                    }
                }else{
                    layer.msg(res.msg,{icon:2});
                }
            }
        })
    }

    function seeEnvDetail(e){
        var spId = $(e).attr('spid');
        var w = "";
        var h = "";
        if (w == null || w == '') {
            w = ($(window).width()*0.9);
        };
        if (h == null || h == '') {
            h = ($(window).height()*0.9);
        }
        parent.layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            title: false,
            closeBtn: 0, //不显示关闭按钮
            shade: 0.8,
            content: '/supervisor/projectManager/evaluationResult?spId=' + spId, //iframe的url，no代表不显示滚动条
        });
    }

    function deleteImg(e, i, j) {
        var imgid = $(j).attr('data-id')
        var imgtype = $(j).attr('data-type')
        parent.layer.confirm('确定删除？', function (index) {
            $.ajax({
                url: '/sys/personCenter/delUserImage',
                data: {type: imgtype},
                type: 'post',
                cache: false,
                dataType: 'json',
                success: function (res) {
                    if (res && res.flag) {
                        layer.msg(res.msg, {icon: 1});
                        $('#' + imgid).removeAttr('src')
                        $(j).hide();
                        parent.layer.close(index);
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            })
        });


    }
</script>
</body>

</html>
